<!DOCTYPE html>
<html data-dpr="1" style="font-size: 54px;">

<head>
    {include file="common/meta2" /}

    {include file="common/meta3" /}

    <script language="javascript">
        function isNumber(obj) {
            return !isNaN(parseFloat(obj)) && isFinite(obj);
        }
        function isPhoneNumber(tel) {
            var reg = /^0?1[3|4|5|6|7|8|9][0-9]\d{8}$/;
            return reg.test(tel);
        }
        function settime(num) {
            var yzm_input = document.getElementById("yzm");
            var num;
            if (num == 0) {
                yzm_input.value = "重新发送";
                yzm_input.removeAttribute("disabled");
                yzm_input.setAttribute("class", "reg_yzminput");
                num = 60;
                return false;
            } else {
                yzm_input.setAttribute("disabled", "disabled");
                yzm_input.setAttribute("class", "reg_yzminput reg_disable")
                yzm_input.value = num + "s后重发";
                num--;
            }
            setTimeout("settime(" + num + ")", 1000);
        }
        $(function () {
            $('.hb_btn').click(function () {
                var verify_code = $('#verify_code').val();
                var login_phone = $('#r_phone').val();
                if (verify_code == '') {
                    layer.msg('请输入图形验证码');
                    return;
                }
                $.post("/api/sms/send", { verify_code: verify_code, mobile: login_phone }, function (ret) {
                    if (ret.code == 1) {
                        layer.msg(ret.msg);
                        settime(60);
                        $('.hb_bar').hide();
                    } else {
                        layer.msg(ret.msg);
                        if (ret.msg == "图形验证码不正确") {
                            $('#verify_code').val('');
                            $('.login_yzm img').attr('src', '/api/common/captcha?_=' + Math.random())
                        }
                    }
                }, 'json');
            });
            $('#yzm').click(function () {
                var login_phone = $('#r_phone').val();
                if (login_phone == '') {
                    layer.msg('手机号不能为空');
                    return;
                }
                if (!isPhoneNumber(login_phone)) {
                    layer.msg('手机号格式不正确');
                    return;
                }
                $('#verify_code').val('');
                $('.login_yzm img').attr('src', '/api/common/captcha?_=' + Math.random())
                $('.hb_bar').show();
            })
            $('.hb_close').click(function () {
                $('.hb_bar').hide();
            });
            $('.login_btn').click(function () {
                var mobile = $('#r_phone').val();
                var captcha = $('#r_code').val();
                var password = $('#r_pass1').val();
                var password2 = $('#r_pass2').val();
                var share_code = $('#r_share_code').val();
                if (mobile == '') {
                    layer.msg('手机号不能为空');
                    return;
                }
                if (!isPhoneNumber(mobile)) {
                    layer.msg('手机号格式不正确');
                    return;
                }
                if (captcha == '') { layer.msg('短信验证码不能为空'); return; }
                if (password == '') { layer.msg('新密码不能为空'); return; }
                if (password2 == '') { layer.msg('确认密码不能为空'); return; }
                if (password != password2) { layer.msg('两次输入密码不一致'); return; }
                if (share_code == '') { layer.msg('分享码不能为空'); return; }
                $.post("/index/user/register", { mobile: mobile, captcha: captcha, password: password, password2: password2, share_code: share_code }, function (ret) {
                    if (ret.code == 1) {
                        layer.msg(ret.msg, { icon: 1, time: 1000 }, function () {
                            window.location.href = "?m=index&c=login";
                        });
                    } else {
                        layer.msg(ret.msg);
                    }
                }, 'json');

            });
        });
    </script>
</head>

<body class="jui_bg_fff" style="font-size: 12px;">
    <!-- 头部 -->
    <div class="jui_top_bar"><a class="jui_top_left" href="javascript:history.back(-1)"><img
                src="/assets/img2/back_111.png"></a>
        <div class="jui_top_middle">注册</div>
    </div>
    <!-- 头部end -->
    <!-- 主体 -->
    <div class="login_bar">
        <div class="jui_h20"></div>
        <div class="jui_public_list jui_flex_justify_between">
            <div class="jui_flex1">
                <span class="iconfont jui_fs20 jui_pad_r12 jui_fc_999 jui_flex_no"></span>
                <input class="jui_flex1" style="max-width:4.5rem;" type="tel" autocomplete="off" placeholder="手机号" id="r_phone">
            </div>
            <div class="reg_yzm"><input class="reg_yzminput fc_zs" id="yzm" type="button" value="发送验证码"></div>
        </div>
        <div class="jui_h12"></div>
        <div class="jui_public_list"> <span class="iconfont jui_fs20 jui_pad_r12 jui_fc_999"></span>
            <input class="flex1" type="text" autocomplete="off" placeholder="短信验证码" id="r_code">
        </div>
        <div class="jui_h12"></div>
        <div class="jui_h12"></div>
        <div class="jui_public_list"> <span class="iconfont jui_fs20 jui_pad_r12 jui_fc_999"></span>
            <input class="flex1" type="password" value="" autocomplete="off" placeholder="登录密码" id="r_pass1">
        </div>
        <div class="jui_h12"></div>
        <div class="jui_public_list"> <span class="iconfont jui_fs20 jui_pad_r12 jui_fc_999"></span>
            <input class="flex1" type="password" value="" autocomplete="off" placeholder="确认密码" id="r_pass2">
        </div>
        <div class="jui_h12"></div>
        <div class="jui_public_list"> <span class="iconfont jui_fs20 jui_pad_r12 jui_fc_999"></span>
            <input class="flex1" type="text" value="" autocomplete="off" placeholder="分享码" id="r_share_code">
        </div>
        <div class="jui_h20"></div>
        <div class="jui_public_btn login_btn"><input type="button" value="提交"></div>
    </div>
    <!-- 主体end -->
    <div class="hb_bar" style="display: none;">
        <div class="hb_con">
            <div class="hb_top">
                <div class="hb_money">请输入右侧验证码</div>
                <div class="jui_public_list">
                    <input class="flex1" type="text" placeholder="验证码" id="verify_code">
                    <div class="login_yzm"> <img src="/api/common/captcha"
                            onclick="this.src='/api/common/captcha?_='+Math.random();"> </div>
                </div>
                <div class="hb_close">X</div>
            </div>
            <div class="hb_btn">立即发送</div>
        </div>
    </div>


</body>

</html>